public class Test {

    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();

        // 前序遍历
        binaryTree.preOrder(root);
        System.out.println();
        System.out.println("=======================");

        // 中序遍历
        binaryTree.inOrder(root);
        System.out.println();
        System.out.println("=======================");

        // 后序遍历
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("=======================");

        //获取树中节点的个数：
        System.out.println(binaryTree.size(root));
        System.out.println("=======================");
        System.out.println(binaryTree.size2(root));

        //获取叶子节点的个数
        System.out.println("=======================");
        System.out.println(binaryTree.getLeafNodeCount1(root));
        System.out.println("=======================");
        System.out.println(binaryTree.getLeafNodeCount2(root));

        System.out.println("=======================");
        //获取第K层节点的个数
        System.out.println(binaryTree.getKLevelNodeCount(root, 1));
        System.out.println(binaryTree.getKLevelNodeCount(root, 2));
        System.out.println(binaryTree.getKLevelNodeCount(root, 3));
        System.out.println(binaryTree.getKLevelNodeCount(root, 4));
        System.out.println(binaryTree.getKLevelNodeCount(root, 5));

        //获取二叉树的高度
        System.out.println("=======================");
        System.out.println(binaryTree.getHight(root));
        System.out.println(binaryTree.getHight2(root));

        // 检测值为value的元素是否存在
        System.out.println("=======================");
        binaryTree.find(root,'A');
        binaryTree.find(root,'F');
        binaryTree.find(root,'H');
        binaryTree.find(root,'X');

        System.out.println("=======================");
        binaryTree.levelOrder(root);
    }

}
